import defProfile from './defProfile';
import chinaMobile from './chinaMobile';

const DEFAULT = 'default';


const profiles = {
  [DEFAULT]: defProfile,
  ['ChinaMobile']: chinaMobile,
};

const getProfile = () => {
  const PROFILE = process.env.PROFILE;
  console.log('profile:', PROFILE);
  const profile = PROFILE || DEFAULT;
  // const profile = 'ChinaMobile';
  console.log('used profile:', profile);
  const profileConfig = profiles[profile];
  if (!profileConfig) {
    throw new Error('不存在的profile：' + profile);
  }
  return profileConfig;
};

const activeProfile = getProfile();
export default activeProfile;